﻿<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="CustomerList.aspx.cs"
    Inherits="CustomerListSMSver" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>来话宝 <%=FTchina.Library.MasterHelper.ClientTitle %>-客 户 信 息 管 理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="/images/style.css" rel="Stylesheet" />
    <script language="javascript" type="text/javascript" src="/js/jiazai.js"></script>
    <script src="/js/introbox.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
    <script language="javascript" type="text/javascript" src="/js/jquery-easyui/jquery.easyui.min.js"></script>
    <script language="javascript" type="text/javascript" src="/js/pagefunction.js"></script>
    <script language="javascript" type="text/javascript" src="/js/jquery.tablesorter.js"></script>
    <script type="text/javascript" >

        $(function () {
            $("#gvList").tablesorter();
            $("#gvList th").css("cursor", "pointer");
        });

        $(function () {
            $("#checkall").click(

        function () {

            if (this.checked) {
                $("input[name='ids']").each(function () { this.checked = true; });
            } else {
                $("input[name='ids']").each(function () { this.checked = false; });
            }
        });
        });

        function openWin(src, width, height, showScroll) {
            window.showModalDialog(src + "?t=" + getRandom(1000), "", "location:No;status:No;help:No;dialogWidth:" + width + ";dialogHeight:" + height + ";scroll:" + showScroll + ";");
            location.reload();
        }


        function jqchk(op) {  //jquery获取复选框值


            var chk_value = [];
            $('input[name="ids"]:checked').each(function () {
                chk_value.push($(this).val());


            });
            var gp = encodeURIComponent($("#ddlpcg").val());
            if (chk_value.length > 0) {
                var url;
                if (op == "group") {
                    url = '/ui/pcustomer.aspx?ids=' + chk_value + '&op=' + gp + '&type=group&back=/ui/lvxingshe/CustomerList.aspx';
                }
                else {
                    url = '/ui/pcustomer.aspx?ids=' + chk_value + '&op=del&type=sms&back=/ui/lvxingshe/CustomerList.aspx';
                }
                window.location.href = url;
            }
            else {
                alert("请至少选择一项");
            }
        }   

    </script>
</head>
<body style="overflow-x: hidden">
    <form id="form1" runat="server">
    <div>
        <table width="100%" class="tableBorder" border='1' cellspacing="0" style="border-collapse: collapse;"
            bgcolor="#ffffff" bordercolor="#cccccc">
            <tr align="center" valign="middle">
                <th height="22" colspan="88">
                    客 户 信 息 管 理
                </th>
            </tr>
            <tr>
                <td>
                    操作
                </td>
                <td>
                    <input type="button" class="btn" value="刷新" onclick="Refresh()" />
                    <input type="button" class="btn" value="下载模板" onclick="Go('/ui/muban.xls')" />
                    <input type="button" class="btn" value="导入" onclick="openWin('/ui/import.aspx','300px','150px','no')" />
                     <input type="button" class="btn" value="添加客户" onclick="Go('?act=add')" />
                    <asp:Button runat="server" ID="btnexcel" Text="导出Excel" OnClick="btnexcel_Click"
                        CssClass="btn" />
                    &nbsp;&nbsp|&nbsp;&nbsp;
                     <asp:DropDownList runat="server" ID="ddlsearchcg">
                     </asp:DropDownList>
                    <asp:TextBox runat="server" ID="txbsearch" Width="80px"></asp:TextBox>
                    <asp:Button runat="server" ID="btnsearch" Text="查询" CssClass="btn" OnClick="btnsearch_Click" />
                    &nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;
                   
                  
                    <input type='checkbox' id='checkall' name='checkall' />全选/取消
                    设置为
                    <asp:DropDownList runat="server" ID="ddlpcg" >
                    </asp:DropDownList>
                    <input class="btn" type="button" onclick="{if(confirm('请确认操作?')){jqchk('group');}return false;}"
                        value="确定" />&nbsp;|&nbsp;
                    <input class="btn" type="button" onclick="{if(confirm('请确认操作?')){jqchk('sms');}return false;}"
                        value="删除" />
                </td>
            </tr>
            <asp:Panel runat="server" ID="plop">
                <tr style='display: none'>
                    <td>
                        id
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbid"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        客户名称
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbcustomerName"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        性别
                    </td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlsex">
                            <asp:ListItem Value="男" Text="男"></asp:ListItem>
                            <asp:ListItem Value="女" Text="女"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        手机号码
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbcustomerTel0"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        单位
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbcustomerWork" Width="60%"></asp:TextBox>
                    </td>
                </tr>
                <tr style='display: none'>
                    <td>
                        客户手机号码2
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbcustomerTel1"></asp:TextBox>
                    </td>
                </tr>
                <tr style='display: none'>
                    <td>
                        客户手机号码3
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbcustomerTel2"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        固定电话
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbcustomerlandline0"></asp:TextBox>
                    </td>
                </tr>
                <tr style='display: none'>
                    <td>
                        固定电话2
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbcustomerlandline1"></asp:TextBox>
                    </td>
                </tr>
                <tr >
                    <td>
                        身份证号码
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbcustomerlandline2"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        客户住址
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbcustomerAddress0" Width="60%"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        说明
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbmemo" Width="60%" Height="100px" TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        客户级别
                    </td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlcg">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr style='display: none'>
                    <td>
                        客户订餐地址
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txbcustomerMeetAddress" Width="60%"></asp:TextBox>
                    </td>
                </tr>
                <tr style='display: none'>
                    <td>
                        callcount
                    </td>
                    <td>
                        <asp:TextBox runat="server" class="easyui-numberbox" ID="txbcallcount"></asp:TextBox>
                    </td>
                </tr>
                <tr style='display: none'>
                    <td>
                        meetCount
                    </td>
                    <td>
                        <asp:TextBox runat="server" class="easyui-numberbox" ID="txbmeetCount"></asp:TextBox>
                    </td>
                </tr>
                <tr style='display: none'>
                    <td>
                        lastCallDate
                    </td>
                    <td>
                        <asp:TextBox runat="server" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                            ID="txblastCallDate"></asp:TextBox>
                    </td>
                </tr>
                <tr style='display: none'>
                    <td>
                        lastMeetDate
                    </td>
                    <td>
                        <asp:TextBox runat="server" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                            ID="txblastMeetDate"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                        <asp:Button runat="server" CssClass="btn" ID="btnCustomerListOk" Text="确定" OnClick="btnCustomerListOk_Click" />
                    </td>
                </tr>
            </asp:Panel>
        </table>
        <table align="center" width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <asp:GridView ID="gvList" runat="server" AllowPaging="false" CellPadding="2" AutoGenerateColumns="False" EnableViewState="false"
                        GridLines="Both" EmptyDataText="当前页无数据" CssClass="tableBorder" Width="100%" OnPreRender="gvList_PreRender">
                        <Columns>
                            <asp:TemplateField HeaderText="序号">
                                <ItemTemplate>
                                    <input type='checkbox' id='ids' name='ids' value='<%# Eval("Id") %>' /><%# Eval("Id") %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="客户名称">
                                <ItemTemplate>
                                    <a style="color: Green; font-weight: bolder" title='header=[说明] body=[点击可打开来电预定界面。]'
                                        href="callin.aspx?phone=<%# Eval("customerTel0") %>">
                                        <%#FTchina.SMS.CustomerInfo.GetCusetomerChenhuByID(Eval("id").ToString())%>                                         
                                        </a>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="custormeSex" HeaderText="性别" />
                             <asp:TemplateField HeaderText="手机">
                                <ItemTemplate>
                                    <a   title='header=[说明] body=[点击可打开来电预定界面。]'
                                        href="callin.aspx?phone=<%# Eval("customerTel0") %>">
                                        <%# Eval("customerTel0").ToString()%>                                         
                                        </a>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="固定电话">
                                <ItemTemplate>
                                    <a  title='header=[说明] body=[点击可打开来电预定界面。]'
                                        href="callin.aspx?phone=<%# Eval("customerlandline0") %>">
                                        <%# Eval("customerlandline0").ToString()%>                                         
                                        </a>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="customerwork" HeaderText="单位" />
                            <asp:BoundField DataField="customerTel1" HeaderText="customerTel1" Visible="false" />
                            <asp:BoundField DataField="customerTel2" HeaderText="customerTel2" Visible="false" />
                             <asp:BoundField DataField="customerlandline1" HeaderText="customerlandline1" Visible="false" />
                            <asp:BoundField DataField="customerlandline2" HeaderText="身份证"  />
                            <asp:BoundField DataField="customerAddress0" HeaderText="客户住址" />
                            <asp:BoundField DataField="customerMeetAddress" HeaderText="客户订餐地址" Visible="false" />
                            <asp:BoundField DataField="memo" HeaderText="说明" />
                            <asp:TemplateField HeaderText="客户级别">
                                <ItemTemplate>
                                    <%#FTchina.SMS.CustomerInfo.GetCustomGroupByGroupID(Eval("customerGroupID").ToString())%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="callcount" HeaderText="callcount" Visible="false" />
                            <asp:BoundField DataField="meetCount" HeaderText="meetCount" Visible="false" />
                            <asp:TemplateField HeaderText="最后来电" Visible="false" >
                                <ItemTemplate>
                                    <%#FTchina.basic.getDisplayDate(Eval("lastCallDate").ToString())%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="最后订餐" Visible="false" >
                                <ItemTemplate>
                                    <%#FTchina.basic.getDisplayDate(Eval("lastMeetDate").ToString())%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="操作">
                                <ItemTemplate>
                                    <input class="btn" type="button" onclick="Go('?act=mod&id=<%#Eval("id") %>')" value="修改" />
                                    <input class="btn" type="button" onclick="javascript:if (confirm('您真的确定要删除吗？\n\n请确认！')==true){Go('?act=del&id=<%#Eval("id")%>')}else{return false}"
                                        value="删除" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <PagerSettings Visible="False" />
                    </asp:GridView>
                </td>
            </tr>
        </table>
        <asp:Literal runat="server" ID="litpager"></asp:Literal>
        <div style="color: Gray">
            提示：点击表头可以排序</div>
    </div>
    </form>
    <script language='javascript' type='text/javascript' src='/JS/tablecolor.js'></script>
    <script type='text/javascript' language='javascript'><!--
        TableColor('gvList', '#F1F8FE', '#FFFFFF', '#F8DC87', '#BCE774');
    --></script>
</body>
</html>
